package com.focus.xyz.other.cases;

import com.focus.xyz.core.common.keyword.Action;
import com.focus.xyz.core.common.listeners.TC;
import com.focus.xyz.core.common.webdriver.DriverFactory;
import com.focus.xyz.core.utils.ProcessUtil;
import com.focus.xyz.other.pages.picc.HomePage;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

/**
 * Created by chenmeng on 2016/7/14.
 */
public class PiccTest extends TC {
    private WebDriver driver;
    private Action action;

    @Parameters({"nodeUrl","browser"})
    @BeforeMethod(alwaysRun = true)
    public void setUp(String nodeUrl,String browser) throws Exception {
        driver = DriverFactory.getDriver(nodeUrl).getBrowser(browser);
        super.init(driver);
        action = new Action(driver);
    }


    @Parameters({"browser"})
    @AfterMethod(alwaysRun = true)
    public void tearDown(String browser) {
        try{
            super.quit();
            driver.quit();
        }catch (Exception e){
            ProcessUtil.closeBrowser(browser);
        }finally {

        }
    }


    @Test
    public void test() throws Exception{
        HomePage homePage = new HomePage(driver,action);
        homePage.openPage();
        homePage.ignoreCertWarning();
        while (true){
            action.pause(1);
        }

    }
}
